package net.xxcl.stuManager.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.SqlSession;
import net.xxcl.stuManager.pojo.Poor;
import net.xxcl.stuManager.pojo.Student;
public class PoorMapper {
	/**
	 * 新增学生建档信息
	 * @param student
	 * @return
	 */
	public int save(Poor poor ) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		int count = session.insert("net.xxcl.stuManager.mapper.PoorMapper.save",poor);
		session.commit();
		return count;
	}
	/**
	 *修改一条学生建档信息
	 * @param id
	 * @return
	 */
	public int update(Poor poor ) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		int count = session.update("net.xxcl.stuManager.mapper.PoorMapper.update",poor);
		session.commit();
		return count;
	}
	/**
	 * 根据id查找
	 * @param id
	 * @return
	 */
	public Poor selectById(Integer id) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		return session.selectOne("net.xxcl.stuManager.mapper.PoorMapper.selectById",id);
	}
	/**
	 * 根据id删除
	 * @param id
	 * @return
	 */
	public int deleteById(Integer id) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		int count = session.delete("net.xxcl.stuManager.mapper.PoorMapper.deleteByid",id);
		session.commit();
		return count;
	}
	/**
	 * 辅导员可管理的学生贫困建档总数
	 * @return
	 */
	public int countpoByTeacherid(Map<String, Object> map) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		return session.selectOne("net.xxcl.stuManager.mapper.PoorMapper.countpoByTeacherid",map);
	}
	/**
	 * 辅导员可管理的学生贫困建档列表
	 * @return
	 */
	public List<Poor> selectpoListByTeacherid(Map<String, Object> map) {
		SqlSession session = DBSessionFactory.getSqlSessionFactory().openSession();
		return session.selectList("net.xxcl.stuManager.mapper.PoorMapper.selectpoListByTeacherid",map);
	}
	
}
